class TreeEntity {
  List<DataBean>? data;
  int? errorCode;
  String? errorMsg;

  static TreeEntity? fromMap(Map<String, dynamic> map) {
    if (map == null) return null;
    TreeEntity treeEntityBean = TreeEntity();
    treeEntityBean.data = []..addAll(
      (map['data'] as List).map((o) => DataBean.fromMap(o)!)
    );
    treeEntityBean.errorCode = map['errorCode'];
    treeEntityBean.errorMsg = map['errorMsg'];
    return treeEntityBean;
  }

  Map toJson() => {
    "data": data,
    "errorCode": errorCode,
    "errorMsg": errorMsg,
  };
}

class DataBean {
  List<dynamic>? articleList;
  String? author;
  List<ChildrenBean>? children;
  int? courseId;
  String? cover;
  String? desc;
  int? id;
  String? lisense;
  String? lisenseLink;
  String? name;
  int? order;
  int? parentChapterId;
  int? type;
  bool? userControlSetTop;
  int? visible;
  bool? isExpanded;//标识是否初始化

  static DataBean? fromMap(Map<String, dynamic> map) {
    if (map == null) return null;
    DataBean dataBean = DataBean();
    dataBean.articleList = map['articleList'];
    dataBean.author = map['author'];
    dataBean.children = []..addAll(
      (map['children'] as List).map((o) => ChildrenBean.fromMap(o)!)
    );
    dataBean.courseId = map['courseId'];
    dataBean.cover = map['cover'];
    dataBean.desc = map['desc'];
    dataBean.id = map['id'];
    dataBean.lisense = map['lisense'];
    dataBean.lisenseLink = map['lisenseLink'];
    dataBean.name = map['name'];
    dataBean.order = map['order'];
    dataBean.parentChapterId = map['parentChapterId'];
    dataBean.type = map['type'];
    dataBean.userControlSetTop = map['userControlSetTop'];
    dataBean.visible = map['visible'];
    dataBean.isExpanded = map['isExpanded'];
    return dataBean;
  }

  Map toJson() => {
    "articleList": articleList,
    "author": author,
    "children": children,
    "courseId": courseId,
    "cover": cover,
    "desc": desc,
    "id": id,
    "lisense": lisense,
    "lisenseLink": lisenseLink,
    "name": name,
    "order": order,
    "parentChapterId": parentChapterId,
    "type": type,
    "userControlSetTop": userControlSetTop,
    "visible": visible,
    "isExpanded": isExpanded,

  };
}

class ChildrenBean {
  List<dynamic>? articleList;
  String? author;
  List<dynamic>? children;
  int? courseId;
  String? cover;
  String? desc;
  int? id;
  String? lisense;
  String? lisenseLink;
  String? name;
  int? order;
  int? parentChapterId;
  int? type;
  bool? userControlSetTop;
  int? visible;

  static ChildrenBean? fromMap(Map<String, dynamic> map) {
    if (map == null) return null;
    ChildrenBean childrenBean = ChildrenBean();
    childrenBean.articleList = map['articleList'];
    childrenBean.author = map['author'];
    childrenBean.children = map['children'];
    childrenBean.courseId = map['courseId'];
    childrenBean.cover = map['cover'];
    childrenBean.desc = map['desc'];
    childrenBean.id = map['id'];
    childrenBean.lisense = map['lisense'];
    childrenBean.lisenseLink = map['lisenseLink'];
    childrenBean.name = map['name'];
    childrenBean.order = map['order'];
    childrenBean.parentChapterId = map['parentChapterId'];
    childrenBean.type = map['type'];
    childrenBean.userControlSetTop = map['userControlSetTop'];
    childrenBean.visible = map['visible'];
    return childrenBean;
  }

  Map toJson() => {
    "articleList": articleList,
    "author": author,
    "children": children,
    "courseId": courseId,
    "cover": cover,
    "desc": desc,
    "id": id,
    "lisense": lisense,
    "lisenseLink": lisenseLink,
    "name": name,
    "order": order,
    "parentChapterId": parentChapterId,
    "type": type,
    "userControlSetTop": userControlSetTop,
    "visible": visible,
  };
}